/*
Copyright 2007 Raymond Giorgi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
 */

package edu.pitt.CS2510.Messages;

import edu.pitt.CS2510.Coordinate;
import edu.pitt.CS2510.Nodes.Node;
/**
 * 
 * @author NoOne
 *
 * This is sent either from the central to a supervisor or from a supervisor
 * to a grunt when the higher wants the lower to attack a location
 */
public class AttackMessage extends Message {
	private final Coordinate coordinate;
	/**
	 * A coordinate must be provided. In the case of a grunt, it will position
	 * itself at that location. In the case of a Supervisor, it will attack
	 * that location. A subtle but important difference
	 * @param to
	 * @param from
	 * @param coord
	 */
	public AttackMessage(int to, int from, Coordinate coord){
		super(to, from);
		coordinate=coord;
	}
	/**
	 * Calls the nodes processAttackMessage();
	 */
	@Override
	public void processMessage(Node node) {
		node.getMessageHandler().processAttackMessage(coordinate);
	}
}
